﻿using APluginFramework.Common;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition.Hosting;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.Composition;

namespace APluginFramework.Core
{
    public class APluginMEFManager:APluginManagerBase
    {
        [APluginImport]
        private Lazy<APlugin> children;

        protected override bool Load()
        {
            bool result = true;
            try
            {
                var catalog = new AggregateCatalog();
                catalog.Catalogs.Add(new AssemblyCatalog(typeof(APluginMEFManager).Assembly));
                var container = new CompositionContainer(catalog);
                container.ComposeParts(this);
            }
            catch (Exception)
            {
                result = false;
            }
            return result;
        }




        public override void OnCallOther(Common.APlugin instance, string cmd, params object[] args)
        {
            
        }

        public override void OnCallRoot(Common.APlugin instance, string cmd, params object[] args)
        {
           
        }
    }
}
